package com.pro.service.imple;

import com.pro.mapper.JsMenuMapper;
import com.pro.pojo.JsMenu;
import com.pro.service.JsMenuService;
import com.pro.utils.RedisCache;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * ClassName:JsMenuServiceImple
 * Package:com.pro.service.imple
 * Description:
 *
 * @Date:2022/1/7 上午 9:41
 * @Author: WYH
 */
@Service
public class JsMenuServiceImple implements JsMenuService {

    @Autowired(required = false)
    private JsMenuMapper jsMenuMapper;

    @Autowired
    private RedisCache redisCache;

    @Override
    public List<JsMenu> getMenu(Integer userId, Integer parentId) {
       /* List<JsMenu> menuList1 = redisCache.getCacheList("menuList");
        if (!menuList1.isEmpty()){
            return menuList1;
        }*/
        //查询导航栏数据
        List<JsMenu> menuList = jsMenuMapper.getMenu(userId, parentId);//所有导航栏
        for (JsMenu jsMenu : menuList) {
            jsMenu.setChildren(jsMenuMapper.getMenu(userId,jsMenu.getMenuId()));//通过父获取子
            List<JsMenu> menuChildren = jsMenu.getChildren();
            for (JsMenu menuChild : menuChildren) {
                menuChild.setChildren(jsMenuMapper.getMenu(userId, menuChild.getMenuId()));
            }
        }
        /*redisCache.setCacheList("menuList",menuList);
        redisCache.expire("menuList",10000);*/
        return menuList;
    }



    @Override
    public Integer expireCount() {
        Integer integer = jsMenuMapper.expireCount();
        return integer;
    }



    /**
     * @Author WYH
     * @Description //TODO 课程待审核数量
     * @Date 上午 11:42 2022/2/15
     * @Param
     * @return  Integer
     **/
    public Integer courseCstatusCount(String courseCstatus){
        Integer integer = jsMenuMapper.courseCstatusCount(courseCstatus);
        return integer;
    }

    /**
     * @Author WYH
     * @Description //TODO 商品待审核
     * @Date 上午 11:52 2022/2/15
     * @Param
     * @return  Integer
     **/
    public Integer resultCount(String result,String type){
        Integer integer = jsMenuMapper.resultCount(result,type);
        return integer;
    }

    /**
     * @Author WYH
     * @Description //TODO 微圈待审核
     * @Date 上午 11:52 2022/2/15
     * @Param
     * @return
     **/
    public Integer aduitLogTypeCount(String type, String aduitLogType){
        Integer integer = jsMenuMapper.aduitLogTypeCount(type, aduitLogType);
        return integer;
    }

    /**
     * @Author WYH
     * @Description //TODO 创作者审核
     * @Date 上午 11:52 2022/2/15
     * @Param
     * @return
     **/
    public Integer jsApplyRecordCount(String result){
        Integer integer = jsMenuMapper.jsApplyRecordCount(result);
        return integer;
    }

    /**
     * @Author WYH
     * @Description //TODO 订单退订
     * @Date 上午 11:53 2022/2/15
     * @Param
     * @return
     **/
    public Integer UnsubscribeCount(String orderStatus){
        Integer integer = jsMenuMapper.UnsubscribeCount(orderStatus);
        return integer;
    }

    //教师↓
    /**
     * @Author WYH
     * @Description //TODO 通过审核课程
     * @Date 上午 8:55 2022/2/16
     * @Param
     * @return
     **/
    public Integer CourseApprovedCountInteger(String courseCstatus){
        Integer integer = jsMenuMapper.CourseApprovedCountInteger(courseCstatus);
        return integer;
    }

    /**
     * @Author WYH
     * @Description //TODO 待付款课程订单
     * @Date 上午 9:08 2022/2/16
     * @Param
     * @return
     **/
    public Integer statusCount(String orderStatus,String orderType){
        Integer integer = jsMenuMapper.statusCount(orderStatus,orderType);
        return integer;
    }

    //运营↓
    /**
     * @Author WYH
     * @Description //TODO 通过审核商品
     * @Date 上午 10:41 2022/2/16
     * @Param result，type
     * @return  Integer
     **/
    public Integer GoodsApprovedCount(String result,String type){
        Integer integer = jsMenuMapper.GoodsApprovedCount(result,type);
        return integer;
    }
    /**
     * @Author WYH
     * @Description //TODO 查询未评论个数
     * @Date 上午 9:13 2022/2/10
     * @Param  comment,orderType
     * @return Integer
     **/
    public Integer commentCount(String comment,String orderType){
        Integer integer = jsMenuMapper.commentCount(comment,orderType);
        return integer;
    }

    //人事↓
    /**
     * @Author WYH
     * @Description //TODO
     * @Date 下午 1:25 2022/2/16
     * @Param position
     * @return  Integer
     **/
    public Integer positionCount(String position){
        Integer integer = jsMenuMapper.positionCount(position);
        return integer;
    }
    /**
     * @Author WYH
     * @Description //TODO 用户封停到期
     * @Date 下午 2:02 2022/2/16
     * @Param type
     * @return  Integer
     **/
    public Integer shutDownCount(String type){
        Integer integer = jsMenuMapper.shutDownCount(type);
        return integer;
    }
}
